<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->

<!-- Bootstrap -->
<link rel="stylesheet" type="text/css" href="<%=basePath%>jslib/bootstrap/css/bootstrap.min.css">
<script type="text/javascript" src="<%=basePath%>jslib/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="<%=basePath%>jslib/bootstrap/js/bootstrap.min.js"></script>

<title>Bootstrap 101 Template</title>
</head>
<body>

	<div class="container">
		<div class="row">
			<div class="toolsTab clearfix"
				style="padding-bottom: 15px; margin-top: 0px;">
				<ul class="nav nav-tabs _load">
					<li class="active"><a
						href="http://www.sojson.com/httpRequest/">HTTP模拟请求</a></li>
					<li class=" "><a
						href="http://www.sojson.com/httpRequest/status/">HTTP状态查询</a></li>
				</ul>
				<div class="clear"></div>
			</div>
			<div class="col-md-12">
				<div class="row">
					<div class="col-md-6">
						<h2>在线HTTP POST/GET ... 接口测试工具</h2>
					</div>
				</div>

				<hr>
				<form id="formId" action="/httpRequest/request.shtml" method="post"
					enctype="multipart/form-data">
					<label>支持的请求协议有：<code>Post</code>、<code>GetDelete</code>、<code>Put</code>、<code>Trace</code>、<code>Head</code>、<code>Options</code>请求。<a
						href="http://www.sojson.com/blog/123.html" target="_blank">本工具源码</a>
						， <a href="http://www.sojson.com/blog/241.html" target="_blank">本工具更新记录</a>。
					</label>
					<div style="margin-bottom: 50px;" class="form-group">
						<div style="padding-left: 0px; padding-right: 0px;"
							class="col-sm-1">
							<select id="type" name="type" class="form-control">
								<option value="Post">Post</option>
								<option value="Get">Get</option>
								<option value="Delete">Delete</option>
								<option value="Put">Put</option>
								<option value="Trace">Trace</option>
								<option value="Head">Head</option>
								<option value="Options">Options</option>
							</select>
						</div>
						<div style="padding-left: 0px; padding-right: 0px;"
							class="col-sm-1">
							<select id="charset" name="charset" class="form-control">
								<option value="UTF-8">UTF-8</option>
								<option value="GBK">GBK</option>
								<option value="GB2312">GB2312</option>
								<option value="GB18030">GB18030</option>
							</select>
						</div>
						<div class="col-sm-6">
							<input type="text" autocomplete="off"
								placeholder="请求地址，以   http://  开头，不支持本地接口" value="" id="url"
								name="url" class="showBox form-control">
						</div>
						<div style="padding-left: 0px; padding-right: 0px;"
							class="col-sm-4">
							<input type="button" id="submit" value="发送请求" class="btn btn-success">
							<input type="checkbox" id="openParameter" checked="checked"	onclick="openInput('.params',this);">
							<label for="openParameter">请求参数</label> 
							<input type="checkbox" id="openHeader" checked="checked" onclick="openInput('.header',this);"> 
							<label for="openHeader">请求Header</label>
						</div>
					</div>
					<br>
					<div style="margin-bottom: 20px;" id="single_parameter"
						class="form-group params">
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
									<th style="width: 30%;">参数名称</th>
									<th style="width: 70%;">参数值</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td colspan="2">
										<button type="button" k="keys" v="values"
											onclick="add_url_parameter(this,'key');"
											class="btn btn-success addParamenter">添加参数</button>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<br>
					<div style="margin-bottom: 20px;" class="form-group header">
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
									<th style="width: 30%;">Header名称</th>
									<th style="width: 70%;">Header值</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td colspan="2">
										<button type="button" k="headKeys" v="headValues"
											onclick="add_url_parameter(this,'head');"
											class="btn btn-success addHeadParamenter">添加参数</button>
										<button type="button"
											onclick="return $('html,body').stop().animate({scrollTop:$('#explain').offset().top-65},500),!1;"
											class="btn btn-default">Header参数解释？</button>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<br>
					<!-- 
					添加cookie
					<div style="margin-bottom: 50px;" class="form-group header">
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
									<th style="width: 30%;">Cookie（没有就不用填入）</th>
									<th style="width: 70%;"><button type="button"
											onclick="so('#_cookie').show('100')" class="btn btn-success">添加Cookie</button></th>
								</tr>
							</thead>
							<tbody>
								<tr id="_cookie" style="display: none;">
									<td colspan="2"><textarea class="form-control" rows="3"
											name="cookie" placeholder="这里是输入Cookie，可以不输入。"></textarea></td>
								</tr>
							</tbody>
						</table>
					</div>
					<br>
					 -->
					<div class="form-group">
						<div style="padding-left: 0px; padding-right: 0px;"
							class="col-sm-4">
							<label for="description">Header</label>
							<textarea placeholder="请求返回的Header信息。" id="head_info"
								calss="form-control"
								style="width: 100%; height: 305px; border: 1px solid #ccc; border-radius: 4px;"
								wrap="off"></textarea>
							<p class="help-block">
								<a target="_blank"
									href="http://www.sojson.com/httpRequest/status/">HTTP状态查询</a>
							</p>
						</div>
						<div class="col-sm-8">
							<label for="description">Response Body （返回值是JSON，会自动格式化）</label>
							<div class="linedwrap">
								<div class="lines" style="width: 50px; height: 349px;">
									<div class="codelines" style="margin-top: 0px;">
										<div class="lineno">1</div>
										<div class="lineno">2</div>
										<div class="lineno">3</div>
										<div class="lineno">4</div>
										<div class="lineno">5</div>
										<div class="lineno">6</div>
										<div class="lineno">7</div>
										<div class="lineno">8</div>
										<div class="lineno">9</div>
										<div class="lineno">10</div>
										<div class="lineno">11</div>
										<div class="lineno">12</div>
										<div class="lineno">13</div>
										<div class="lineno">14</div>
										<div class="lineno">15</div>
										<div class="lineno">16</div>
										<div class="lineno">17</div>
										<div class="lineno">18</div>
									</div>
								</div>
								<textarea placeholder="Response Body info" id="json_input"
									style="resize: both; width: 684px; max-width: 676px;" rows="6"
									wrap="off" spellcheck="false" class="json_input"></textarea>
							</div>
						</div>
					</div>
					<input type="hidden" name="submitType" id="_submitType"> <input
						type="hidden" name="keys" value="opsojsoncompo0o0o0o"> <input
						type="hidden" name="values" value="opsojsoncompo0o0o0o">

				</form>

			</div>
		</div>
		<div class="row">
			<h4 id="explain">Requests Header | Http Header</h4>
			<table class="table table-bordered content-table">
				<thead>
					<tr>
						<th>Header</th>
						<th width="35%">解释</th>
						<th width="40%">示例</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td>Accept</td>
						<td>指定客户端能够接收的内容类型</td>
						<td>Accept:text/plain,text/html</td>
					</tr>
					<tr>
						<td>Accept-Charset</td>
						<td>浏览器可以接受的字符编码集。</td>
						<td>Accept-Charset:iso-8859-5</td>
					</tr>
					<tr>
						<td>Accept-Encoding</td>
						<td>指定浏览器可以支持的web服务器返回内容压缩编码类型。</td>
						<td>Accept-Encoding:compress,gzip</td>
					</tr>
					<tr>
						<td>Accept-Language</td>
						<td>浏览器可接受的语言</td>
						<td>Accept-Language:en,zh</td>
					</tr>
					<tr>
						<td>Accept-Ranges</td>
						<td>可以请求网页实体的一个或者多个子范围字段</td>
						<td>Accept-Ranges:bytes</td>
					</tr>
					<tr>
						<td>Authorization</td>
						<td>HTTP授权的授权证书</td>
						<td>Authorization:Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==</td>
					</tr>
					<tr>
						<td>Cache-Control</td>
						<td>指定请求和响应遵循的缓存机制</td>
						<td>Cache-Control:no-cache</td>
					</tr>
					<tr>
						<td>Connection</td>
						<td>表示是否需要持久连接。（HTTP 1.1默认进行持久连接）</td>
						<td>Connection:close</td>
					</tr>
					<tr>
						<td>Cookie</td>
						<td>HTTP请求发送时，会把保存在该请求域名下的所有cookie值一起发送给web服务器。</td>
						<td>Cookie:$Version=1;Skin=new;</td>
					</tr>
					<tr>
						<td>Content-Length</td>
						<td>请求的内容长度</td>
						<td>Content-Length:348</td>
					</tr>
					<tr>
						<td>Content-Type</td>
						<td>请求的与实体对应的MIME信息</td>
						<td>Content-Type:application/x-www-form-urlencoded</td>
					</tr>
					<tr>
						<td>Date</td>
						<td>请求发送的日期和时间</td>
						<td>Date:Tue,15 Nov&nbsp;2010 08:12:31 GMT</td>
					</tr>
					<tr>
						<td>Expect</td>
						<td>请求的特定的服务器行为</td>
						<td>Expect:100-continue</td>
					</tr>
					<tr>
						<td>From</td>
						<td>发出请求的用户的Email</td>
						<td>From:user@email.com</td>
					</tr>
					<tr>
						<td>Host</td>
						<td>指定请求的服务器的域名和端口号</td>
						<td>Host:www.zcmhi.com</td>
					</tr>
					<tr>
						<td>If-Match</td>
						<td>只有请求内容与实体相匹配才有效</td>
						<td>If-Match:“737060cd8c284d8af7ad3082f209582d”</td>
					</tr>
					<tr>
						<td>If-Modified-Since</td>
						<td>如果请求的部分在指定时间之后被修改则请求成功，未被修改则返回304代码</td>
						<td>If-Modified-Since:Sat,29 Oct 2010 19:43:31 GMT</td>
					</tr>
					<tr>
						<td>If-None-Match</td>
						<td>如果内容未改变返回304代码，参数为服务器先前发送的Etag，与服务器回应的Etag比较判断是否改变</td>
						<td>If-None-Match:“737060cd8c284d8af7ad3082f209582d”</td>
					</tr>
					<tr>
						<td>If-Range</td>
						<td>如果实体未改变，服务器发送客户端丢失的部分，否则发送整个实体。参数也为Etag</td>
						<td>If-Range:“737060cd8c284d8af7ad3082f209582d”</td>
					</tr>
					<tr>
						<td>If-Unmodified-Since</td>
						<td>只在实体在指定时间之后未被修改才请求成功</td>
						<td>If-Unmodified-Since:Sat,29 Oct 2010 19:43:31 GMT</td>
					</tr>
					<tr>
						<td>Max-Forwards</td>
						<td>限制信息通过代理和网关传送的时间</td>
						<td>Max-Forwards:10</td>
					</tr>
					<tr>
						<td>Pragma</td>
						<td>用来包含实现特定的指令</td>
						<td>Pragma:no-cache</td>
					</tr>
					<tr>
						<td>Proxy-Authorization</td>
						<td>连接到代理的授权证书</td>
						<td>Proxy-Authorization:Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==</td>
					</tr>
					<tr>
						<td>Range</td>
						<td>只请求实体的一部分，指定范围</td>
						<td>Range:bytes=500-999</td>
					</tr>
					<tr>
						<td>Referer</td>
						<td>先前网页的地址，当前请求网页紧随其后,即来路</td>
						<td>Referer:http:</td>
					</tr>
					<tr>
						<td>TE</td>
						<td>客户端愿意接受的传输编码，并通知服务器接受接受尾加头信息</td>
						<td>TE:trailers,deflate;q=0.5</td>
					</tr>
					<tr>
						<td>Upgrade</td>
						<td>向服务器指定某种传输协议以便服务器进行转换（如果支持）</td>
						<td>Upgrade:HTTP/2.0,SHTTP/1.3,IRC/6.9,RTA/x11</td>
					</tr>
					<tr>
						<td>User-Agent</td>
						<td>User-Agent的内容包含发出请求的用户信息</td>
						<td>User-Agent:Mozilla/5.0(Linux;X11)</td>
					</tr>
					<tr>
						<td>Via</td>
						<td>通知中间网关或代理服务器地址，通信协议</td>
						<td>Via:1.0 fred,1.1 nowhere.com(Apache/1.1)</td>
					</tr>
					<tr>
						<td>Warning</td>
						<td>关于消息实体的警告信息</td>
						<td>Warn:199 Miscellaneous warning</td>
					</tr>
				</tbody>
			</table>
		</div>

	</div>

</body>
</html>